package com.csu.tour.controller;


import com.csu.tour.entity.Booking;
import com.csu.tour.service.BookingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/bookings")
public class BookingController {
    @Autowired
    private final BookingService bookingService;

    public BookingController(BookingService bookingService) {
        this.bookingService = bookingService;
    }

    @GetMapping("/{roomId}")
    public Booking getBookingByRoomId(@PathVariable int roomId) {

        return bookingService.getBookingByRoomId(roomId);
    }

}
